package emarket;

public class Offer {

	private Item _item;
	private Trader _trader;
	
	
	public Offer ( String itemName, String traderName )
	{
		this._item = new Item( itemName );
		this._trader = new Trader( traderName );
	}
	
	

	public void set_item(Item _item) {
		this._item = _item;
	}

	public Item get_item() {
		return _item;
	}

	public void set_trader(Trader _trader) {
		this._trader = _trader;
	}

	public Trader get_trader() {
		return _trader;
	}

	
	public boolean equals(Object o )
	{
		
		if(!(o instanceof Offer))
		{
			throw new ClassCastException("Invalid object");
		}
		
		Offer other = (Offer) o;
		
		if( this == other )
			return true;
		
		if( other.get_item().equals( this._item) && other.get_trader().equals(this._trader) )
			return true;
		
		return false;
	}
	
	public String toString()
	{
		return _item + "," + _trader;
	}
}
